<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>
        <ui:composition template="/publico/template.xhtml">
            <ui:define name="content">
                <h:form id="fprincipal">
                    <p:panel header="Pelotização" >
                        <h:panelGrid columns="2">
                            <h:outputLabel 
                                for="itLote" 
                                value="Lote: "/>
                            <h:inputText 
                                id="itLote"
                                readonly="true"
                                value="#{processoBean.processo.id}"/>

                            <h:outputLabel 
                                for="ittamanhopellet" 
                                value="Tamanho do pellet: *"/>
                            <p:inputText
                                id="ittamanhopellet"
                                value="#{processoBean.pelotizacao.tamanhoDoPellet}"/>

                            <h:outputLabel 
                                for="cdatapelotizacao" 
                                value="Data: *"/>
                            <p:calendar 
                                id="cdatapelotizacao" 
                                value="#{processoBean.pelotizacao.dataDePelotizacao}" 
                                required="true"/>

                            <h:outputLabel 
                                for="soequipamento" 
                                value="Equipamento: *"/>
                            <h:selectOneMenu 
                                id="soequipamento" 
                                value="#{processoBean.pelotizacao.equipamento}"
                                converter="EquipamentoConversor">
                                <f:selectItems value="#{equipamentoBean.equipamentos}"
                                               var="e"
                                               itemLabel="#{e.nome}"
                                               itemValue="#{e}"/>
                            </h:selectOneMenu>

                            <h:outputLabel 
                                id="olaplicacaopellet"
                                for="soaplicacaopellet"   
                                value="Aplicacao do pellet: *"/>
                            <h:selectOneMenu 
                                id="soaplicacaopellet" 
                                value="#{processoBean.pelotizacao.aplicacaoPellet}"
                                converter="AplicacaoConversor">
                                <f:selectItems value="#{aplicacaoBean.aplicacoes}"
                                               var="a"
                                               itemLabel="#{a.nome}"
                                               itemValue="#{a}"/>
                            </h:selectOneMenu>

                            <h:outputLabel 
                                for="solocal" 
                                value="Local: "/>
                            <h:selectOneMenu 
                                id="solocal" 
                                value="#{processoBean.pelotizacao.localPelotizacao}"
                                converter="LocalConversor">
                                <f:selectItems value="#{localBean.locais}"
                                               var="l"
                                               itemLabel="#{l.nome}"
                                               itemValue="#{l}"/>
                            </h:selectOneMenu>
                        </h:panelGrid>

                        <p:commandButton
                            id="cbSalvar"
                            ajax="false" 
                            action="#{processoBean.salvarPelotizacao()}"
                            value="Salvar"/>
                        
                        <p:button id="voltar"
                                  value="Voltar"
                                  outcome="/restrito/lote/informacao-lote.xhtml"/>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
